<script>
          
       $("#add_company").validate({
            
            submitHandler: function(form) {
                $(form).ajaxSubmit({
                    target: "#content",
                    beforeSubmit:function(){
                        $(".submit_button").hide();
                            
                    }
                    
                }
       
            );
                
                
            }
           
        });                    
    $(document).ready(function() {
       
        $(".calendario").datepicker({
            yearRange: '1900:2050',
            dateFormat: 'yy-mm-dd',
            showOn: 'both',
            buttonImage: './img/calendar.jpg',
            buttonImageOnly: true,
            changeYear: true,
            numberOfMonths: 1

        });
    });
         
            
</script>
<h1>Ingresar datos de la empresa</h1>

<?php echo $this->Form->create("Company", array("id" => "add_company", "action" => "add")) ?>

</table><table border="0" width="100%">

    <tbody>
        <tr>
            <td colspan="4"><?php echo $this->Form->input('Company.razon_social',array('class'=>'required')); ?></td>

        </tr>
        <tr>
            <td colspan="2"><?php echo $this->Form->input('Company.representante_legal'); ?></td>
            <td><?php echo $this->Form->input('Company.cedula_representante_legal'); ?></td>
            <td><?php echo $this->Form->input('Company.telefono_representante_legal'); ?></td>
        </tr>
        <tr>

            <td colspan="2" ><?php echo $this->Form->input('Company.personeria_juridica'); ?></td>
            <td><?php echo $this->Form->input('Company.fecha_personeria_juridica', array('class' => 'calendario', 'type' => 'text')); ?></td>
            <td><?php echo $this->Form->input('Company.fecha_constitucion', array('class' => 'calendario', 'type' => 'text')); ?></td>

        </tr>
        <tr>
            <td colspan="2"><?php echo $this->Form->input('Company.nit'); ?></td>
            <td colspan="2"><?php echo $this->Form->input('Company.objeto_social'); ?></td>

        </tr>
        <tr>
            <td colspan="2"><?php echo $this->Form->input('Company.direccion'); ?></td>
            <td colspan="2"><?php echo $this->Form->input('Company.telefonos'); ?></td>


        </tr>

        <tr>
            <td colspan="2"><?php echo $this->Form->input('Company.nombre_del_encuestado'); ?></td>
            <td colspan="2"><?php echo $this->Form->input('Company.numero_inicial_hombres'); ?></td>
        </tr>
        <tr>
            <td colspan="2"><?php echo $this->Form->input('Company.cargo_del_encuestado'); ?></td>
            <td colspan="2"><?php echo $this->Form->input('Company.numero_actual_hombres'); ?></td>

        </tr>
        <tr>
            <td colspan="2"><?php echo $this->Form->input('Company.numero_inicial_mujeres'); ?></td>
            <td colspan="2"><?php echo $this->Form->input('Company.numero_actual_mujeres'); ?></td>

        </tr>

        <tr>
            <td><?php echo $this->Form->input('Company.departament_id', array('id' => 'departamentos', 'label' => 'Departamentos', 'empty' => 'seleccione departamento')); ?>
                <?php
                echo $this->Ajax->observeField('departamentos', array(
                    'url' => array('controller' => 'Companies', 'action' => 'select'),
                    'frequency' => 0.2,
                    'update' => 'ciudades',
                        )
                );
                ?>
            </td>
            <td><div id="ciudades"><?php echo $this->Form->input('Company.city_id', array('label' => 'Municipio', 'empty' => 'Seleccione municipio','class'=>'required')); ?></div></td>
            <td><?php echo $this->Form->input('Company.vereda'); ?></td>

        </tr>
        <tr>
            <td colspan="4"><?php echo $this->Form->input('Company.corregimiento'); ?></td>

        </tr>


    </tbody>
</table>




<?php echo $this->Form->end(array('label'=>'Guardar Empresa','class'=>'submit_button')); ?>
 

